package demo.bocweb.login_module.activity;

import android.support.annotation.NonNull;

import com.alibaba.android.arouter.facade.annotation.Route;

import demo.bocweb.com.sdk.base.BasePresenter;
import demo.bocweb.com.sdk.base.activity.BaseMVPActivity;
import demo.bocweb.com.sdk.baseApi.RequestHelper;
import demo.bocweb.com.sdk.config.ARoutConfig;
import demo.bocweb.com.sdk.util.Loading;
import demo.bocweb.com.sdk.util.ToastyUtil;
import demo.bocweb.login_module.contract.ResetPwdContract;
import demo.bocweb.login_module.presenter.ResetPwdPresenter;
import demo.bocweb.user_module.R;

/**
 * 修改密码
 * Created by zhelun on 2018/2/3.
 */
@Route(path = ARoutConfig.resetPwdPath)
public class ResetPwdActivity extends BaseMVPActivity<ResetPwdContract.IResetPwdPresenter, ResetPwdContract.IResetPwdModel> implements ResetPwdContract.IResetPwdView {
    @NonNull
    @Override
    public BasePresenter initPresenter() {
        return new ResetPwdPresenter();
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_reset_pwd;
    }

    @Override
    public void resetPwdSuccess() {
        // TODO: 2018/2/3  修改密码成功(是否需要重新登录？)
        ToastyUtil.showSuccess("修改密码成功");
        finish();
    }

    @Override
    public void resetPwd() {
        Loading.show(this, getString(R.string.str_loading));
        mPresenter.resetPwd(RequestHelper.build().add("Password", "").add("NewPassword", "").create());
    }
}
